﻿using System.DrawingCore;
using QRCoder;

namespace _55_C_生成二维码并添加Logo
{
    internal class Program
    {
        static void Main(string[] args)
        {
            //下载二维码第三方工具包QRCoder
            QRCodeGenerator codeGenerator = new QRCodeGenerator();
            QRCodeData qRCodeData = codeGenerator.CreateQrCode(@"https:\\www.baidu.com",QRCodeGenerator.ECCLevel.H);
            QRCode qrCode = new QRCode(qRCodeData);
            Bitmap logo = new Bitmap("logo.ico");
            Bitmap bitmap = qrCode.GetGraphic(15,Color.Black,Color.White,logo,10,10,true);
            //Bitmap bitmap = qrCode.GetGraphic(15,Color.Black,Color.White,true);
            //Image image = Image.FromHbitmap(bitmap.GetHbitmap());
            bitmap.Save("D:\\test.png");
            Console.WriteLine("生成成功");
            Console.ReadKey();
        }
    }
}
